package account;

import javax.servlet.http.HttpSession;

import utils.SessionVar;
import utils.Var;

/**
 * Created by IntelliJ IDEA.
 * User: Shawn
 * Date: 2009-7-22
 * Time: 21:49:28
 */
public class AccountUtils {

  public static boolean isAdmin(HttpSession session) {
    String account = (String) session.getAttribute(SessionVar.USER_ACCOUNT);
    return account.equals(Var.ADMIN_ACCOUNT);
  }

  public static boolean hasRight(HttpSession session, int right) {
    long rights = (Long) session.getAttribute(SessionVar.USER_RIGHTS);
    return (rights & right) != 0;
  }
}
